import configparser
import os

root_path = os.path.dirname(os.path.abspath(__file__))

class Config(configparser.ConfigParser):
    def __init__(self, defaults=None):
        configparser.ConfigParser.__init__(self, defaults=defaults)

    def optionxform(self, optionstr):
        return optionstr
    
config = Config()

config.read(os.path.join(root_path, 'database.ini'))
username = config.get('mysql', 'username')
password = config.get('mysql', 'password')
url = config.get('mysql', 'url')
port = config.get('mysql', 'port')
db = config.get('mysql', 'db')
mes_db = config.get('mysql', 'mes_db')

oracle_host = config.get('oracle', 'host')
oracle_port = config.get('oracle', 'port')
oracle_username = config.get('oracle', 'username')
oracle_password = config.get('oracle', 'password')
oracle_view = config.get('oracle', 'view')
oracle_service_name = config.get('oracle', 'service_name')


sql_host = config.get('sqlserver', 'host')
sqle_port = config.get('sqlserver', 'port')
sql_username = config.get('sqlserver', 'username')
sql_password = config.get('sqlserver', 'password')
sql_db = config.get('sqlserver', 'db')

config.read(os.path.join(root_path, 'server.ini'))
scp_ip = config.get('lot', 'scp_ip')
data_volume = config.get('lot', 'data_volume')


csv_dir =f"{data_volume}/jd/csv"
material_dir =f"{data_volume}/jd/material"
